LIBCOMMON=../../..
CC=gcc
CFLAGS+=-Wall
INCLS=-I$(LIBCOMMON)/include
LIBS=-L$(LIBCOMMON)/lib -lcommon -lpthread

.PHONY : default all debug release clean

objects=main.o monitor.o worker.o svc.o errlog.o
targets=server_ep server_ep_debug

default : debug

all : debug release

debug : server_ep_debug

server_ep_debug : $(objects)
	$(CC) $(CFLAGS) $(INCLS) -o $@ $^ $(LIBS)
	chmod 744 $@

$(objects) : %.o : %.c
	$(CC) $(CFLAGS) -D_MY_DEBUG -g $(INCLS) -c -o $@ $<

release : server_ep

server_ep : $(objects:%.o=%.c)
	$(CC) $(CFLAGS) -O3 $(INCLS) -o $@ $^ $(LIBS)
	chmod 744 $@

clean :
	rm -f core* *.log $(objects) $(targets)
